import dynamic from 'dva/dynamic';

// wrapper of dynamic
const dynamicWrapper = (app, models, component) => dynamic({
  app,
  models: () => models.map(m => import(`../models/${m}.js`)),
  component,
});

// nav data  user相关的放在前面，适应router匹配规则
export const getNavData = app => [
  // {
  //   component: dynamicWrapper(app, ['user'], () => import('../layouts/UserLayout')),
  //   layout: 'UserLayout',
  //   path: '/user',
  //   children: [
  //     {
  //       name: '登录',
  //       path: 'login',
  //       component: dynamicWrapper(app, [], () => import('../routes/User/Login')),
  //     },
  //     {
  //       name: '找回密码',
  //       path: 'password',
  //       component: dynamicWrapper(app, [], () => import('../routes/User/Password')),
  //     },
  //     {
  //       name: '注册',
  //       path: 'register',
  //       component: dynamicWrapper(app, [], () => import('../routes/User/Register')),
  //     },
  //   ],
  // },
  {
    component: dynamicWrapper(app, ['app'], () => import('../layouts/IndexLayout')),
    layout: 'Index',
    name: '首页',
    path: '/',
    children: [
     // {
     //   name: '需求变更管理',
     //   icon: 'bars',
     //   path: 'featureManage',
     //   children: [
     //     {
     //       name: '表格管理',
     //       icon: 'table',
     //       path: 'table',
     //       component: dynamicWrapper(app, ['user'], () => import('../routes/Example/Table')),
     //     },
     //      {
     //        name: 'Tab管理',
     //        icon: 'file-text',
     //        path: 'tab',
     //        component: dynamicWrapper(app, ['user'], () => import('../routes/Example/Tab')),
     //      },
     //     {
     //       name: '版本管理',
     //       icon: 'file-text',
     //       path: 'versionPlan',
     //       component: dynamicWrapper(app, ['analysis'], () => import('../routes/Analysis/VersionPlan')),
     //     },
     //     {
     //       name: '需求变更统计',
     //       icon: 'table',
     //       path: 'AnalysisStatics',
     //       children: [
     //         {
     //           name: '版本需求变更统计',
     //           icon: 'table',
     //           path: 'VersionAnalysis',
     //           component: dynamicWrapper(app, ['analysis'], () => import('../routes/Analysis/VersionAnalysis')),
     //         },
     //         {
     //           name: '版本需求变更详情',
     //           icon: 'table',
     //           path: 'VersionAnalysisDetail',
     //           component: dynamicWrapper(app, ['analysis'], () => import('../routes/Analysis/VersionAnalysisDetail')),
     //         },
     //         {
     //           name: 'Sprint需求变更统计',
     //           icon: 'table',
     //           path: 'SprintAnalysis',
     //           component: dynamicWrapper(app, ['analysis'], () => import('../routes/Analysis/SprintAnalysis')),
     //         },
     //         {
     //           name: 'Sprint需求变更详情',
     //           icon: 'table',
     //           path: 'SprintAnalysisDetail',
     //           component: dynamicWrapper(app, ['analysis'], () => import('../routes/Analysis/SprintAnalysisDetail')),
     //         },
     //       ],
     //     },
     //   ],
     // },
      {
        name: '测试报告管理',
        icon: 'bars',
        path: 'testreport',
        component: dynamicWrapper(app, ['testreport'], () => import('../routes/TestReportManage/Table')),
      },
      {
        name: 'CASE管理',
        icon: 'bars',
        path: 'casemanage',
        children: [
          {
            name: '用例执行',
            icon: 'table',
            path: 'executecase',
            component: dynamicWrapper(app, ['casemanage'], () => import('../routes/CaseManage')),
          },
          {
            name: '测试结果查询',
            icon: 'table',
            path: 'caseresult',
            component: dynamicWrapper(app, ['smokereport'], () => import('../routes/SmokeResultManage')),
          },
          {
            name: 'excel和xml格式转换',
            icon: 'table',
            path: 'xmltoexcel',
            component: dynamicWrapper(app, ['xmlexcel'], () => import('../routes/XmlExcelManage')),
          },
        ],
      },
     {
       name: '质量管理',
       icon: 'bars',
       path: 'prjmanage',
       children: [
         {
           name: '质量统计查询',
           icon: 'table',
           path: 'prjchart',
           component: dynamicWrapper(app, ['quality'], () => import('../routes/PrjProcessAnalysis')),
         },
         {
           name: '质量报告管理',
           icon: 'table',
           path: 'qualityAnalysis',
           component: dynamicWrapper(app, ['qualityreport'], () => import('../routes/QualityReportManage')),
         },
       ],
     },
     {
      name: '项目配置',
      icon: 'bars',
      path: 'project',
      component: dynamicWrapper(app, ['project'], () => import('../routes/ProjectManage/Table')),
    },
      // {
      //   name: '配置管理',
      //   icon: 'setting',
      //   path: 'config',
      //   children: [
      //     {
      //       name: '参数管理',
      //       icon: 'tags-o',
      //       path: 'paramManager',
      //       component: dynamicWrapper(app, [], () => import('../routes/Config/Params')),
      //     },
      //   ],
      // },
      // {
      //   name: '图表展示',
      //   icon: 'area-chart',
      //   path: 'chart',
      //   component: dynamicWrapper(app, ['user'], () => import('../routes/Chart')),
      // },
    ],
  },
];
